
package se.sll.service.catalogue.gui.api.resource;

import java.util.List;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Response;
import se.sll.service.catalogue.gui.api.model.UserAddToUnit;
import se.sll.service.catalogue.gui.api.model.UserCreate;
import se.sll.service.catalogue.gui.api.model.UserList;


/**
 * Handles information of different users
 * 
 */
@Path("users")
public interface UsersService {


    /**
     * Get all users. NOTE - careUnit is not returned
     * 
     */
    @GET
    @Produces({
        "application/json"
    })
    UsersService.GetUsersResponse getUsers()
        throws Exception
    ;

    /**
     * Create a new User
     * 
     * @param entity
     *      e.g. {
     *       "status": "OPEN",
     *       "hsaId": "SE2321000016-FHR3",
     *       "realname": "Bosse Bäckström",
     *       "email": "bosse.backstrom@bockling.nu",
     *       "hsaID": "SE2321000016-FHR3",
     *       "password": "********",
     *       "role": "Vaktmästare",
     *       "careUnitID":
     *       [
     *         {
     *           "hsaId": "SE2321000016-45FD",
     *           "displayName": "Enhet X"
     *         }
     *       ]
     *     }
     *     
     */
    @POST
    @Consumes("application/json")
    @Produces({
        "application/json"
    })
    UsersService.PostUsersResponse postUsers(UserCreate entity)
        throws Exception
    ;

    /**
     * Sets user for the specified unit.
     * 
     * @param entity
     *      e.g. {
     *       "unitId": "1111AFAF1",
     *       "hsaId": "SE2321000016-TDDR"
     *     }
     *     
     */
    @PUT
    @Path("units/setusers")
    @Consumes("application/json")
    UsersService.PutUsersUnitsSetusersResponse putUsersUnitsSetusers(UserAddToUnit entity)
        throws Exception
    ;

    /**
     * Get a specific User
     * 
     * @param hsaId
     *     
     */
    @GET
    @Path("{hsaId}")
    @Produces({
        "application/json"
    })
    UsersService.GetUsersByHsaIdResponse getUsersByHsaId(
        @PathParam("hsaId")
        String hsaId)
        throws Exception
    ;

    /**
     * Update the information for a specific user.
     * 
     * @param hsaId
     *     
     * @param entity
     *      e.g. {
     *       "status": "OPEN",
     *       "hsaId": "SE2321000016-FHR3",
     *       "realname": "Bosse Bäckström",
     *       "email": "bosse.backstrom@bockling.nu",
     *       "hsaID": "SE2321000016-FHR3",
     *       "password": "********",
     *       "role": "Vaktmästare",
     *       "careUnitID":
     *       [
     *         {
     *           "hsaId": "SE2321000016-45FD",
     *           "displayName": "Enhet X"
     *         }
     *       ]
     *     }
     *     
     */
    @PUT
    @Path("{hsaId}")
    @Consumes("application/json")
    @Produces({
        "application/json"
    })
    UsersService.PutUsersByHsaIdResponse putUsersByHsaId(
        @PathParam("hsaId")
        String hsaId, UserCreate entity)
        throws Exception
    ;

    /**
     * Delete an offer
     * 
     * @param hsaId
     *     
     */
    @DELETE
    @Path("{hsaId}")
    UsersService.DeleteUsersByHsaIdResponse deleteUsersByHsaId(
        @PathParam("hsaId")
        String hsaId)
        throws Exception
    ;

    /**
     * Updates the role for a specific user
     * 
     * @param role
     *     
     * @param hsaId
     *     
     */
    @PUT
    @Path("{hsaId}/role/{role}")
    UsersService.PutUsersByHsaIdRoleByRoleResponse putUsersByHsaIdRoleByRole(
        @PathParam("role")
        String role,
        @PathParam("hsaId")
        String hsaId)
        throws Exception
    ;

    /**
     * Get all users for the given unit
     * 
     * @param unitId
     *     
     */
    @GET
    @Path("units/{unitId}")
    @Produces({
        "application/json"
    })
    UsersService.GetUsersUnitsByUnitIdResponse getUsersUnitsByUnitId(
        @PathParam("unitId")
        String unitId)
        throws Exception
    ;

    /**
     * Finds email addresses for administrators for the given units. This method will return emails for users with roles CAREUNITADMIN and CAPACITYADMIN.
     * 
     * @param entity
     *      e.g. [
     *       "Unit 1",
     *       "Unit 2"
     *     ]
     *     
     */
    @POST
    @Path("emails")
    @Consumes("application/json")
    @Produces({
        "application/json"
    })
    UsersService.PostUsersEmailsResponse postUsersEmails(List<String> entity)
        throws Exception
    ;

    public class DeleteUsersByHsaIdResponse
        extends se.sll.service.catalogue.gui.api.support.ResponseWrapper
    {


        private DeleteUsersByHsaIdResponse(Response delegate) {
            super(delegate);
        }

        /**
         * Offer was deleted successfully (no content in response body)
         * 
         */
        public static UsersService.DeleteUsersByHsaIdResponse withoutContent() {
            Response.ResponseBuilder responseBuilder = Response.status(204);
            return new UsersService.DeleteUsersByHsaIdResponse(responseBuilder.build());
        }

    }

    public class GetUsersByHsaIdResponse
        extends se.sll.service.catalogue.gui.api.support.ResponseWrapper
    {


        private GetUsersByHsaIdResponse(Response delegate) {
            super(delegate);
        }

        /**
         * The requested User was found and is returned in the body. e.g. {
         *   "careUnits": [],
         *   "createdByHsaId": "",
         *   "creationTime": 1391636105000,
         *   "email": "",
         *   "hsaId": "super",
         *   "lastLogin": 1428666138000,
         *   "realname": "super",
         *   "role": "SUPERADMIN",
         *   "sourceSystemHsaId": "",
         *   "status": "ACTIVE",
         *   "updatedTime": 1391636105000
         * }
         * 
         * 
         * @param entity
         *     {
         *       "careUnits": [],
         *       "createdByHsaId": "",
         *       "creationTime": 1391636105000,
         *       "email": "",
         *       "hsaId": "super",
         *       "lastLogin": 1428666138000,
         *       "realname": "super",
         *       "role": "SUPERADMIN",
         *       "sourceSystemHsaId": "",
         *       "status": "ACTIVE",
         *       "updatedTime": 1391636105000
         *     }
         *     
         */
        public static UsersService.GetUsersByHsaIdResponse jsonOK(UserList entity) {
            Response.ResponseBuilder responseBuilder = Response.status(200).header("Content-Type", "application/json");
            responseBuilder.entity(entity);
            return new UsersService.GetUsersByHsaIdResponse(responseBuilder.build());
        }

    }

    public class GetUsersResponse
        extends se.sll.service.catalogue.gui.api.support.ResponseWrapper
    {


        private GetUsersResponse(Response delegate) {
            super(delegate);
        }

        /**
         * The requested User was found and is returned in the body. e.g. [
         *   {
         *     "careUnits": [],
         *     "createdByHsaId": "",
         *     "creationTime": 1391636105000,
         *     "email": "",
         *     "hsaId": "super",
         *     "lastLogin": 1428666138000,
         *     "realname": "super",
         *     "role": "SUPERADMIN",
         *     "sourceSystemHsaId": "",
         *     "status": "ACTIVE",
         *     "updatedTime": 1391636105000
         *   },
         *   {
         *     "careUnits": [],
         *     "createdByHsaId": "",
         *     "creationTime": 1399452714000,
         *     "email": "ca@sll.se",
         *     "hsaId": "ca",
         *     "lastLogin": null,
         *     "realname": "Capacity Admin",
         *     "role": "CAPACITYADMIN",
         *     "sourceSystemHsaId": "",
         *     "status": "ACTIVE",
         *     "updatedTime": 1399452714000
         *   }
         * ]
         * 
         * 
         * @param entity
         *     [
         *       {
         *         "careUnits": [],
         *         "createdByHsaId": "",
         *         "creationTime": 1391636105000,
         *         "email": "",
         *         "hsaId": "super",
         *         "lastLogin": 1428666138000,
         *         "realname": "super",
         *         "role": "SUPERADMIN",
         *         "sourceSystemHsaId": "",
         *         "status": "ACTIVE",
         *         "updatedTime": 1391636105000
         *       },
         *       {
         *         "careUnits": [],
         *         "createdByHsaId": "",
         *         "creationTime": 1399452714000,
         *         "email": "ca@sll.se",
         *         "hsaId": "ca",
         *         "lastLogin": null,
         *         "realname": "Capacity Admin",
         *         "role": "CAPACITYADMIN",
         *         "sourceSystemHsaId": "",
         *         "status": "ACTIVE",
         *         "updatedTime": 1399452714000
         *       }
         *     ]
         *     
         */
        public static UsersService.GetUsersResponse jsonOK(List<UserList> entity) {
            Response.ResponseBuilder responseBuilder = Response.status(200).header("Content-Type", "application/json");
            responseBuilder.entity(entity);
            return new UsersService.GetUsersResponse(responseBuilder.build());
        }

    }

    public class GetUsersUnitsByUnitIdResponse
        extends se.sll.service.catalogue.gui.api.support.ResponseWrapper
    {


        private GetUsersUnitsByUnitIdResponse(Response delegate) {
            super(delegate);
        }

        /**
         * The user information was found and is returned in the body. e.g. [
         *   {
         *     "careUnits": [],
         *     "createdByHsaId": "",
         *     "creationTime": 1391636105000,
         *     "email": "",
         *     "hsaId": "super",
         *     "lastLogin": 1428666138000,
         *     "realname": "super",
         *     "role": "SUPERADMIN",
         *     "sourceSystemHsaId": "",
         *     "status": "ACTIVE",
         *     "updatedTime": 1391636105000
         *   },
         *   {
         *     "careUnits": [],
         *     "createdByHsaId": "",
         *     "creationTime": 1399452714000,
         *     "email": "ca@sll.se",
         *     "hsaId": "ca",
         *     "lastLogin": null,
         *     "realname": "Capacity Admin",
         *     "role": "CAPACITYADMIN",
         *     "sourceSystemHsaId": "",
         *     "status": "ACTIVE",
         *     "updatedTime": 1399452714000
         *   }
         * ]
         * 
         * 
         * @param entity
         *     [
         *       {
         *         "careUnits": [],
         *         "createdByHsaId": "",
         *         "creationTime": 1391636105000,
         *         "email": "",
         *         "hsaId": "super",
         *         "lastLogin": 1428666138000,
         *         "realname": "super",
         *         "role": "SUPERADMIN",
         *         "sourceSystemHsaId": "",
         *         "status": "ACTIVE",
         *         "updatedTime": 1391636105000
         *       },
         *       {
         *         "careUnits": [],
         *         "createdByHsaId": "",
         *         "creationTime": 1399452714000,
         *         "email": "ca@sll.se",
         *         "hsaId": "ca",
         *         "lastLogin": null,
         *         "realname": "Capacity Admin",
         *         "role": "CAPACITYADMIN",
         *         "sourceSystemHsaId": "",
         *         "status": "ACTIVE",
         *         "updatedTime": 1399452714000
         *       }
         *     ]
         *     
         */
        public static UsersService.GetUsersUnitsByUnitIdResponse jsonOK(List<UserList> entity) {
            Response.ResponseBuilder responseBuilder = Response.status(200).header("Content-Type", "application/json");
            responseBuilder.entity(entity);
            return new UsersService.GetUsersUnitsByUnitIdResponse(responseBuilder.build());
        }

    }

    public class PostUsersEmailsResponse
        extends se.sll.service.catalogue.gui.api.support.ResponseWrapper
    {


        private PostUsersEmailsResponse(Response delegate) {
            super(delegate);
        }

        /**
         *  e.g. [
         *   "bosse.backstrom@bockling.nu",
         *   "adam.andersson@amail.as"
         * ]
         * 
         * @param entity
         *     [
         *       "bosse.backstrom@bockling.nu",
         *       "adam.andersson@amail.as"
         *     ]
         */
        public static UsersService.PostUsersEmailsResponse jsonOK(List<String> entity) {
            Response.ResponseBuilder responseBuilder = Response.status(200).header("Content-Type", "application/json");
            responseBuilder.entity(entity);
            return new UsersService.PostUsersEmailsResponse(responseBuilder.build());
        }

    }

    public class PostUsersResponse
        extends se.sll.service.catalogue.gui.api.support.ResponseWrapper
    {


        private PostUsersResponse(Response delegate) {
            super(delegate);
        }

        /**
         * The requested User was successfully created and is returned in the body e.g. {
         *   "careUnits": [],
         *   "createdByHsaId": "",
         *   "creationTime": 1391636105000,
         *   "email": "",
         *   "hsaId": "super",
         *   "lastLogin": 1428666138000,
         *   "realname": "super",
         *   "role": "SUPERADMIN",
         *   "sourceSystemHsaId": "",
         *   "status": "ACTIVE",
         *   "updatedTime": 1391636105000
         * }
         * 
         * 
         * @param entity
         *     {
         *       "careUnits": [],
         *       "createdByHsaId": "",
         *       "creationTime": 1391636105000,
         *       "email": "",
         *       "hsaId": "super",
         *       "lastLogin": 1428666138000,
         *       "realname": "super",
         *       "role": "SUPERADMIN",
         *       "sourceSystemHsaId": "",
         *       "status": "ACTIVE",
         *       "updatedTime": 1391636105000
         *     }
         *     
         */
        public static UsersService.PostUsersResponse jsonCreated(UserList entity) {
            Response.ResponseBuilder responseBuilder = Response.status(201).header("Content-Type", "application/json");
            responseBuilder.entity(entity);
            return new UsersService.PostUsersResponse(responseBuilder.build());
        }

    }

    public class PutUsersByHsaIdResponse
        extends se.sll.service.catalogue.gui.api.support.ResponseWrapper
    {


        private PutUsersByHsaIdResponse(Response delegate) {
            super(delegate);
        }

        /**
         * The user was updated and the new User object is returned in the Body e.g. {
         *   "careUnits": [],
         *   "createdByHsaId": "",
         *   "creationTime": 1391636105000,
         *   "email": "",
         *   "hsaId": "super",
         *   "lastLogin": 1428666138000,
         *   "realname": "super",
         *   "role": "SUPERADMIN",
         *   "sourceSystemHsaId": "",
         *   "status": "ACTIVE",
         *   "updatedTime": 1391636105000
         * }
         * 
         * 
         * @param entity
         *     {
         *       "careUnits": [],
         *       "createdByHsaId": "",
         *       "creationTime": 1391636105000,
         *       "email": "",
         *       "hsaId": "super",
         *       "lastLogin": 1428666138000,
         *       "realname": "super",
         *       "role": "SUPERADMIN",
         *       "sourceSystemHsaId": "",
         *       "status": "ACTIVE",
         *       "updatedTime": 1391636105000
         *     }
         *     
         */
        public static UsersService.PutUsersByHsaIdResponse jsonOK(UserList entity) {
            Response.ResponseBuilder responseBuilder = Response.status(200).header("Content-Type", "application/json");
            responseBuilder.entity(entity);
            return new UsersService.PutUsersByHsaIdResponse(responseBuilder.build());
        }

    }

    public class PutUsersByHsaIdRoleByRoleResponse
        extends se.sll.service.catalogue.gui.api.support.ResponseWrapper
    {


        private PutUsersByHsaIdRoleByRoleResponse(Response delegate) {
            super(delegate);
        }

        /**
         * The Role was updated. No content in response.
         * 
         */
        public static UsersService.PutUsersByHsaIdRoleByRoleResponse withoutContent() {
            Response.ResponseBuilder responseBuilder = Response.status(204);
            return new UsersService.PutUsersByHsaIdRoleByRoleResponse(responseBuilder.build());
        }

    }

    public class PutUsersUnitsSetusersResponse
        extends se.sll.service.catalogue.gui.api.support.ResponseWrapper
    {


        private PutUsersUnitsSetusersResponse(Response delegate) {
            super(delegate);
        }

        /**
         * The user information was successfully updated.
         * 
         */
        public static UsersService.PutUsersUnitsSetusersResponse withoutContent() {
            Response.ResponseBuilder responseBuilder = Response.status(204);
            return new UsersService.PutUsersUnitsSetusersResponse(responseBuilder.build());
        }

    }

}
